<!-- $Id: order_info.htm 17060 2010-03-25 03:44:42Z liuhui $ -->
{if $full_page}
{include file="pageheader.htm"}
{insert_scripts files="topbar.js,../js/utils.js,listtable.js,selectzone.js,../js/common.js,jquery-1.6.2.min.js,chosen.jquery.min.js"}
<script type="text/javascript" src="../js/calendar.php?lang={$cfg_lang}"></script>
<link href="../js/calendar/calendar.css" rel="stylesheet" type="text/css" />
<link href='styles/store.css' rel='stylesheet' type='text/css' />
<link href='styles/chosen/chosen.css' rel='stylesheet' type='text/css' />
<!--搜索区域-->
<div class="form-div">
  <form action="supplier_rebate.php" name="searchForm" method="post">
  <input type="hidden" name="suppid" value="{$smarty.request.suppid}">
    <table width="100%" cellpadding="0" cellspacing="0" border="0">
      <tr>
        <td width="9%" align="right">账户变动时间：</td>
        <td colspan="3">
		<input name="start_time" type="text" id="start_time" value="{$favourable.start_time}" readonly="readonly" />
        <input name="selbtn1" type="button" id="selbtn1" onclick="return showCalendar('start_time', '%Y-%m-%d %H:%M', '24', false, 'selbtn1');" value="{$lang.btn_select}" class="button" />&nbsp;-&nbsp;<input name="end_time" type="text" id="end_time" value="{$favourable.end_time}" readonly="readonly" /><input name="selbtn2" type="button" id="selbtn2" onclick="return showCalendar('end_time', '%Y-%m-%d %H:%M', '24', false, 'selbtn2');" value="{$lang.btn_select}" class="button" />
            <a href="javascript:;" class="rebate_time" onclick="set_time(this,'{$today.start}','{$today.ends}')">今日</a>
            <a href="javascript:;" class="rebate_time" onclick="set_time(this,'{$yestoday.start}','{$yestoday.ends}')">昨日</a>
            <a href="javascript:;" class="rebate_time" onclick="set_time(this,'{$week.start}','{$week.ends}')">最近7天</a>
            <a href="javascript:;" class="rebate_time" onclick="set_time(this,'{$month.start}','{$month.ends}')">最近30天</a>
        </td>
      </tr>
      <tr>
        <td width="9%" align="right">支付方式：</td>
        <td width="15%">
        	<select class="chzn-select" name='payid' id="payid" style='width:123px;'>
    			<option value='0' selected='selected'>全部</option>
				{foreach from=$payinfo item=pay}
    			<option value='{$pay.pay_id}'>{$pay.pay_name}</option>
				{/foreach}
    		</select></td>
        <td width="67%">
			<select class="chzn-select" data-placeholder="商家订单号" style="width:350px;" name="orderid"> 
				<option value=""></option>
                {* 代码增加 By www.68ecshop.com Start *}
                <option value="">全部</option>
                {* 代码增加 By www.68ecshop.com End *}
				{foreach from=$supplier_order item=supp}
				   <option value="{$supp.order_id}">{$supp.order_sn}</option>  
				{/foreach}
				</select>

            <a class="button_round" onclick="searchSupp()">搜索</a>
            <a class="button_round" onclick="exportGoods()">批量导出</a>
        </td>
      </tr>
    </table>
  </form>
</div>
<div class="list-div" id="listDiv">
{/if}
  <table cellpadding="3" cellspacing="1">
    <tr>
      <th><a href="javascript:listTable.sort('sr.add_time'); ">账户变动时间</a></th>
      <th>订单号</th>
      <th>订单金额（元）</th>
      <th>平台扣除佣金（元）</th>
	  <th>商家实际收入金额（元）</th>
      <th>支付方式</th>
      <th>备注</th>
    </tr>
	{foreach from=$supplier_list item=supplier}
    <tr>
	  <td align="center">{$supplier.add_time}</td>
      <td align="center">{$supplier.order_sn}</td>
      <td align="center">{$supplier.all_money}</td>
      <td align="center">-{$supplier.rebate_money}</td>
      <td align="center" class="add">+{$supplier.result_money}</td>
      <td align="center">{$supplier.pay_name}</td>
	  <td align="center">{$supplier.texts}</td>
    </tr>
	{/foreach}
	<!--没有佣金记录的显示-->
    <!--<tr><td class="no-records" colspan="7">{$lang.no_records}</td></tr>-->

  </table>
<table id="page-table" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
    <td align="right" nowrap="true">
    {include file="page.htm"}
    </td>
  </tr>
</table>

{if $full_page}
</div>
{literal}
<script language="JavaScript">
listTable.query = "search_supp_query";
listTable.recordCount = {$record_count};
listTable.pageCount = {$page_count};

{foreach from=$filter item=item key=key}
listTable.filter.{$key} = '{$item}';
{/foreach}
onload = function()
{
	// 开始检查订单
	startCheckOrder();
}

function check(status)
{
	if(status <= 0){//冻结状态下结算佣金验证
		var snArray = new Array();
		var eles = document.forms['theForm'].elements;
		for (var i=0; i<eles.length; i++)
		{
			if (eles[i].tagName == 'INPUT' && eles[i].type == 'checkbox' && eles[i].checked && eles[i].value != 'on')
			{
			  snArray.push(eles[i].value);
			}
		}
		if (snArray.length == 0)
		{
			alert('请选择要结算的订单!');
			return false;
		}
		else
		{
			eles['order_id'].value = snArray.toString();
			return true;
		}
	}
	else if(status == 1){//可结算状态下撤销全部佣金
		if(confirm('撤销后，佣金状态由可结算将回归到冻结状态')){
			return true;
		}else{
			return false;
		}
	}
}

function set_time(obj,starttime,endtime){
	
	if($(obj).hasClass("cur")){
		$('.rebate_time').removeClass("cur");
		$('#start_time').val('');
		$('#end_time').val('');
	}else{
		$('.rebate_time').removeClass("cur");
		$(obj).addClass("cur");
		$('#start_time').val(starttime);
		$('#end_time').val(endtime);
	}
}

function searchSupp()
{
	listTable.filter['start_time'] = Utils.trim(document.forms['searchForm'].elements['start_time'].value);
	listTable.filter['end_time'] = Utils.trim(document.forms['searchForm'].elements['end_time'].value);
	listTable.filter['payid'] = Utils.trim(document.forms['searchForm'].elements['payid'].value);
	listTable.filter['orderid'] = Utils.trim(document.forms['searchForm'].elements['orderid'].value);
	listTable.filter['page'] = 1;
	listTable.loadList();
}

function exportGoods()
{
	var frm=document.forms['searchForm'];
	frm.action ="supplier_rebate.php?act=export_goods&is_export=1";
	frm.submit();
}

</script>

<script type="text/javascript">
	$().ready(function(){
		$(".chzn-select").chosen();
	});
</script>
{/literal}

{include file="pagefooter.htm"}
{/if}